package com.example.nophase.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.RadioButton;

import com.example.nophase.R;
import com.example.nophase.entity.Project;

import java.util.List;

public class DialogListAdapter extends BaseAdapter {
    List<Project> list;
    Context context;

    public DialogListAdapter(List<Project> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_lv_item,null);
        RadioButton radioButton = view.findViewById(R.id.radio_item);
        radioButton.setText(list.get(position).getProName());
        radioButton.setChecked(list.get(position).isChecked());
        return view;
    }
}
